var mdulePath = '/usr/local/lib/node_modules/';
var mongoose = require(mdulePath+'mongoose');
var Schema = mongoose.Schema;
mongoose.connect('mongodb://dc:dcjia19920313@localhost/dcjia',function(err){
  if(err){
    console.log(err);
  }
  else{
    console.log('connect to mongodb succeed');
  }
});
/*
    我们的目标是: 智能教学!
*/
var userSchema = new Schema({
    account: {type: Number},
    /*账号,不可重复*/
    salt:{type: String},
    hash:{type: String},
    /*加盐密码*/
    name: {type: String},
    /*真实姓名*/
    sex: {type: Number},
    /*性别:女(0)和男(1)*/
    avatar: {type: String},
    /*头像url路径*/
    role: {type: Number},
    /*教学角色，目前有老师(0)和学生(1)两种*/
    socketId: {type: String}
    /*在线时的通信管道标示符,只记录最新连接的socketId*/
});
var userModel = mongoose.model('user',userSchema);
exports.userModel  = userModel;
